﻿<%@CODEpage="65001"%>
<!--#include file="../inc/conn.asp"-->
<!DOCTYPE html>
<html>
<meta charset="utf-8"/>
<head>
<title>捐赠管理</title>
<link href="<%=sitepath%>theme/css/users.css" rel="stylesheet">
<script src="<%=sitepath%>theme/js/jquery.js"></script>
<script src="<%=sitepath%>theme/js/manage.js"></script>
</head>
<%
Call OpenData()
if request.querystring <> "" then
	id = request("id")
	Select Case request("act")
		Case "del" Call Del(id)
	End Select
End if
'sql
fWord = request("w")
sql = sql & "select id,[sum],alipay,username,email,ordertime,paytime,[status] from [donate-list] where id > 0"
qStr = ""
If fWord <> "" Then sql = sql & " and (username like '%"&Trim(fWord)&"%' or alipay like '%"&Trim(fWord)&"%' or email like '%"&Trim(fWord)&"%' or url like '%"&Trim(fWord)&"%')" : qStr = qStr & "&w="&fWord
sql = sql & " order by ID desc"
'response.write sql :response.end
set rs = server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
If Not rs.eof Then
'分页
dim currentpage
maxperpage=30 '信息显示条数
rs.pagesize=maxperpage
currentpage=request.queryString("p")
if currentpage="" or not isnumeric(currentpage) then
	currentpage=1
elseif currentpage<1 then
	currentpage=1
else
	currentpage=clng(currentpage)
	if currentpage > rs.pageCount Then currentpage=rs.pageCount
end if
			  
dim totalput,n
totalput=rs.recordcount
if totalput mod maxperpage=0 then
	n=totalput\maxperpage
else
	n=totalput\maxperpage+1
end if
if n = 0 then n = 1
rs.move(currentpage-1)*maxperpage
i = 0
do while i < maxperpage and not rs.eof
	id = rs("id")
	sum = rs("sum")
	alipay = rs("alipay")
	username = rs("username")
	email = rs("email")
	ordertime = rs("ordertime")
	paytime = rs("paytime")
	status = rs("status")
	if status then statusStr = "已支付" else statusStr = "未支付"
		str = str & "<tr><td class='chk'><input type='checkbox' name='id' value='"&id&"' /></td><td class='t'><a href='donate-datail.asp?id="&id&"'>"&username&"</a></td><td class='t'>"&sum&"</td><td>"&alipay&"</td><td>"&email&"</td><td>"&ordertime&"</td><td>"&paytime&"</td><td>"&statusStr&"</td><td><a href='donate-action.asp?id="&id&"'>编辑</a> <a href='javascript:;' onclick='del("&id&")'>删除</a></td></tr>"
	i=i+1      
	rs.movenext
Loop
Else
	str = "<tr><td colspan='8'>没有捐赠记录！</td></tr>"
End if
rs.close:set rs = nothing
'page
pageCount = n
If currentpage>1 Then 
	pageStr = pageStr & "<a href='?p="&currentpage-1&qStr&"'>&laquo; 上一页</a>"
Else
	pageStr = pageStr & "<span class='disabled'>&laquo; 上一页</span>"
End if
If pageCount<=10 Then
	For i = 1 To pageCount
		If i = currentpage Then 
			pageStr = pageStr & "<span class='current'>"&i&"</span>"
		Else
			pageStr = pageStr & "<a href='?p="&i&qStr&"'>"&i&"</a>"
		End if
	Next
else
	For i = 1 To 2
		If i = currentpage Then 
			pageStr = pageStr & "<span class='current'>"&i&"</span>"
		Else
			pageStr = pageStr & "<a href='?p="&i&qStr&"'>"&i&"</a>"
		End if
	Next
	If currentpage>6 Then 
		pageStr = pageStr & "..."
	End if

	ks =  currentpage-3
	If ks <1 Then ks =1
	For i = ks To currentpage+3
		If i>=pageCount-1 Then Exit For
		If i>2 Then  
			If i = currentpage Then 
				pageStr = pageStr & "<span class='current'>"&i&"</span>"
			Else
				pageStr = pageStr & "<a href='?p="&i&qStr&"'>"&i&"</a>"
			End if
		End If
	Next

	If pageCount-1-(currentpage+3)>1  Then
		pageStr = pageStr & "..."
	End if

	For i = pageCount-1 To pageCount
		If i = currentpage Then 
			pageStr = pageStr & "<span class='current'>"&i&"</span>"
		Else
			pageStr = pageStr & "<a href='?p="&i&qStr&"'>"&i&"</a>"
		End if
	Next
End if

If currentpage<pageCount Then 
	pageStr = pageStr & "<a href='?p="&currentpage+1&qStr&"'>下一页 &raquo;</a>"
Else
	pageStr = pageStr & "<span class='disabled'>下一页 &raquo;</span>"
End If

%>
<body>
<section class="page">
	<article class="page-inner">
		<header class="page-hd">
			<h1 class="logo"><a href="/" class="hide-txt">给点吧<sup>爱心捐赠平台</sup></a></h1>
		</header>
		<section class="page-bd">
			<aside class="side">
				<nav class="menu" role="navigation">
					<ul>
						<li><a href="">账户信息</a></li>
						<li><a href="">创建梦想</a></li>
						<li class="cur"><a href="">捐赠管理</a></li>
						<li><a href="">关于</a></li>
						<li><a href="">退出</a></li>
					</ul>
				</nav>
			</aside>
			<section class="main" role="main">
				<article class="inner">
					<div class="hd">
						<h1>捐赠列表</h1>
					</div>
					<div class="bd">
						<form action="?" method="post" class="mod-data">
						<table class="mod-table">
							<thead>
								<tr>
									<td colspan="9">
										<p class="count">总共有：<strong><%=totalput%></strong>条捐赠，共<strong><%=n%></strong>页，每页<strong><%=maxperpage%></strong>条，当前第<strong><%=currentpage%></strong>页。</p>
										<fieldset class="filter">关键字：<input type="search" placeholder="姓名、邮箱、支付宝帐号" class="txt" name="w" value="<%=fWord%>" /><button type="submit">查找</button></fieldset>
									</td>
								</tr>
								<tr>
									<td colspan="9" class="act-bar"><button type="button">支付成功</button><button type="button">删除</button><div class="page"><%=pageStr%></div></td>
								</tr>
								<tr>
									<th class="chk"><input type="checkbox" name="all" /></th>
									<th class="t">捐赠人</th>
									<th class="d">金额</th>
									<th class="">支付宝</th>
									<th class="">邮箱</th>
									<th class="">订单日期</th>
									<th class="">付款日期</th>
									<th class="">状态</th>
									<th class="act">操作</th>
								</tr>
							</thead>
							<tfoot>
								<td class="act-bar" colspan="9"><button type="button">支付成功</button><button type="button">删除</button><div class="page"><%=pageStr%></div></td>
							</tfoot>
							<tbody><%=str%></tbody>
						</table>
						</form>
					</div>
				</article>
			</section>
		</section>
		<footer class="page-ft" role="contentinfo">
			<nav role="navigation"><a href="">关于</a>|<a href="">声明</a>|<a href="">帮助</a>|<a class="join" href="http://isux.tencent.com/jobs#fed" title="腾讯ISUX招聘前端开发工程师"><strong>ISUX</strong><i class="icon-isux"></i></a></nav>
			<small class="copyright">&copy; 2011 geidianba.com</small>
		</footer>
	</article>
</section>
<%Call CloseData()%>
</body>
</html>
